<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>Package Documentation for org.apache.struts.taglib.template Package</title>
</head>
 <body bgcolor="white">
   
   <p>
   	<b>Note:</b> As of Struts 1.1 the template tag library is 
   	deprecated in favor of Tiles.
   </p>
<p>     The "struts-template" tag library contains tags that are useful in
creating dynamic     JSP templates for pages which share a common format.
These templates are best used     when it is likely that a layout shared
by several pages in your application will     change. The functionality provided
by these tags is similar to what can be     achieved using standard JSP include
directive, but are dynamic rather than static.   </p>
   <a name="doc.Description"></a>
    
<p>  </p>
<div align="Center"> <a href="#doc.Introduction">[Introduction]</a>
 <a href="#doc.Functionality">[Template   Functionality]</a>
 <a href="#TagLib_Template_UML_">[Template UML]</a>
<a href="#doc.Properties">[Template Properties]</a>
 <a href="#doc.Examples">[Template   Examples]</a>
 </div>
   
<p></p>
    
<hr /=""> <a name="doc.Intro"></a>
 
<h3>Introduction<a name="doc.Introduction"></a>
</h3>
    
<p>     The Template library supplies tags that are useful for creating dynamic
JSP templates     for pages which share a common format.   </p>
   <a name="doc.Functionality"></a>
 
<h3>Template Tag Functionality<a name="doc.Functionality"></a>
</h3>
 
<p>Each of the three template tags has a specific, interelated function:</p>
 
<p> </p>
<ul>
   <li><b><a href="../../../../../../userGuide/struts-template.html#get">get</a>
    </b> - Retrieves content from a request scope bean, for use in the template
layout.</li>
   <li><b><a href="../../../../../../userGuide/struts-template.html#insert">insert</a>
    </b> - Retrieves (or includes) the specified template file, and then
inserts the specified content into the template's layout. By changing the
layout defined in the template file, any other file that inserts the template
will automatically use the new layout.</li>
   <li><b><a href="../../../../../../userGuide/struts-template.html#put">put</a>
    </b> - Creates a request scope bean that specifies the content to be
used by the get tag. Content can be printed directly or included from a JSP
or HTML fil</li>
  <li><br>
    <br>
    <br>
  </li>
  <li><a name="TagLib_Template_UML_"></a>
    <img src="doc-files/template.gif" alt="TagLib Template UML">
  </li>
 
</ul>
 
<p></p>
  
<h3>Template Tag Properties<a name="doc.Properties"></a>
</h3>
  
<p>The three template tags use very simple attributes :</p>
 
<blockquote>   
  <p><b>get</b> - Requires a single property, the name of the content to
be inserted. This tag is used in the template file to indicate where in the
layout to insert the content. This name matches the name property used by
a put tag.</p>
   
  <p><b>insert</b> - Requires a single property, the name of the template.
This tag is the parent to one or more put tags. The put tags indicate the
content to be inserted into the template. The layout of the content is determined
by get tags placed in the template.</p>
   
  <p><b>put</b> - Requires a name property, which should match a name used
in the template file. The content property indicates the source of the content.
The optional direct attribute indicates whether the content should be included
or printed directly (as a literal string). The default is false, meaning
content is included.</p>
   <a name="doc.Examples"></a>
 
  <h3>Template Tag Examples</h3>
  
  <p align="Center"><b>A sample template file</b></p>
 
  <blockquote> 
    <hr> 
    <pre>&lt;%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template' %&gt;<br>&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;template:get name='title'/&gt;&lt;/title&gt;&lt;/head&gt;<br>&lt;body background='graphics/blueAndWhiteBackground.gif'&gt;<br>&lt;table&gt;<br>  &lt;tr valign='top'&gt;&lt;td&gt;&lt;template:get name='sidebar'/&gt;&lt;/td&gt;<br>      &lt;td&gt;&lt;table&gt;<br>            &lt;tr&gt;&lt;td&gt;&lt;template:get name='header'/&gt;&lt;/td&gt;&lt;/tr&gt;<br>            &lt;tr&gt;&lt;td&gt;&lt;template:get name='content'/&gt;&lt;/td&gt;&lt;/tr&gt;<br>            &lt;tr&gt;&lt;td&gt;&lt;template:get name='footer'/&gt;&lt;/td&gt;&lt;/tr&gt;<br>          &lt;/table&gt;<br>      &lt;/td&gt;<br>   &lt;/tr&gt;<br>&lt;/table&gt;<br>&lt;/body&gt;&lt;/html&gt;<br>&lt;%<br>/*<br>"chapterTemplate.jsp"<br>Display a "sidebar" in a column along the left side of the page.<br>Display a "header" over the right column.<br>Display the page "content" below the header.<br>Display a "footer" at below the content.<br>If we change the layout of the elements on this page, all pages<br>inserting this page will also change to use the new layout.<br>*/<br>%&gt;<br></pre>
 
    <hr> </blockquote>
 
    <p align="Center"><b>A sample JSP using the template</b></p>
 
    <blockquote> 
      <hr> 
      <pre>&lt;%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template' %&gt;<br>&lt;template:insert template='/chapterTemplate.jsp'&gt;<br>  &lt;template:put name='title' content='Templates' direct='true'/&gt;<br>  &lt;template:put name='header' content='/header.html' /&gt;<br>  &lt;template:put name='sidebar' content='/sidebar.jsp' /&gt;<br>  &lt;template:put name='content' content='/introduction.html'/&gt;<br>  &lt;template:put name='footer' content='/footer.html' /&gt;<br>&lt;/template:insert&gt;<br>&lt;%<br>/*<br>"introduction.jsp"<br>Specify template for this page (chapterTemplate.jsp).<br>The chapterTemplate.jsp defines the layout positions for five<br>elements: title, header, sidebar, content, and footer.<br>Specify the source file (html or jsp) for each element.<br>*/<br>%&gt;<br></pre>
 
      <hr> </blockquote>
 
      <p align="Center"><b>A sample HTML content file ("header.html") used
by "introduction.jsp", and others.</b></p>
 
      <blockquote> 
        <hr> 
        <pre>&lt;table&gt;<br>&lt;tr&gt;<br>&lt;td&gt;&lt;img src='graphics/java.gif'/&gt;&lt;/td&gt;<br>&lt;td&gt;&lt;img src='graphics/templates.gif'/&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br>&lt;/table&gt;<br></pre>
 
        <hr> </blockquote>
 
        <p align="Center"><b>A sample JSP content file ("sidebar.jsp") used
by "introduction.jsp", and others.</b></p>
 
        <blockquote> 
          <hr> 
          <pre>&lt;font size='5'&gt;&lt;a name="top"&gt;Topics&lt;/a&gt;&lt;/font&gt;&lt;p&gt;<br>&lt;table width='145'&gt;<br>    &lt;tr&gt;&lt;td&gt;&lt;a href='introduction.jsp'&gt;<br>        Introduction &lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;<br>
    &lt;tr&gt;&lt;td&gt;&lt;a href='using.jsp'&gt;<br>        Using Templates &lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;<br>
    &lt;tr&gt;&lt;td&gt;&lt;a href='optional.jsp'&gt;<br>        Optional Content &lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td&gt;&lt;a href='more.jsp'&gt;<br>        ... and more ...&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;<br>  &lt;/table&gt;&lt;/p&gt;<br>
&lt;%<br>/*<br>Specify navigational links for this application.<br>*/<br>%&gt;<br></pre>
 
          <hr> </blockquote>
 
          <p align="Center"><b>A sample HTML content file used by "introduction.jsp"
only.</b></p>
 
          <blockquote> 
            <hr> 
            <pre>&lt;html&gt;<br>&lt;head&gt;<br>&lt;link rel="stylesheet" href="css/templates.css" <br>charset="ISO-8859-1" type="text/css"&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;h3 class="ChapTitle"&gt;Introduction&lt;/h3&gt;<br>&lt;p class="Paragraph"&gt;Window toolkits typically provide a layout mechanism<br>&lt; ... /&gt;<br><hr>
</pre>
 </blockquote>
 <!--
<h3>Optional Content</h3>
<p>All content is optional. If a source page does not specify the content for an element in the template, that element is simply ignored. This can make using templates more flexible, since you can use the same template for more than one page, simply by ommitting or specifying a content element. However, this feature also means that a misspelled name could lead the template to quietly ignore content you meant to include.</p>
-->
 </blockquote>
            </body>
            </html>
